package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.RawMaterialManagementMapper;
import com.ruoyi.system.domain.RawMaterialManagement;
import com.ruoyi.system.service.IRawMaterialManagementService;

/**
 * 原料管理 Service业务层处理
 *
 * @author ruoyi
 * @date 2025-05-24
 */
@Service
public class RawMaterialManagementServiceImpl implements IRawMaterialManagementService
{
    @Autowired
    private RawMaterialManagementMapper rawMaterialManagementMapper;

    /**
     * 通过id查询原料管理
     *
     * @param id 原料管理主键
     * @return 原料管理
     */
    @Override
    public RawMaterialManagement selectRawMaterialManagementById(Long id)
    {
        return rawMaterialManagementMapper.selectRawMaterialManagementById(id);
    }

    /**
     * 通过条件查询原料管理列表
     *
     * @param materialName,barcode 原料名称，原料条码
     * @return 原料管理
     */
    @Override
    public List<RawMaterialManagement> selectRawMaterialManagementListByConditions(String materialName, String barcode)
    {
        return rawMaterialManagementMapper.selectRawMaterialManagementListByConditions(materialName,barcode);
    }

    /**
     * 新增原料管理
     *
     * @param rawMaterialManagement 原料管理
     * @return 结果
     */
    @Override
    public int insertRawMaterialManagement(RawMaterialManagement rawMaterialManagement)
    {
        rawMaterialManagement.setCreateTime(DateUtils.getNowDate());
        return rawMaterialManagementMapper.insertRawMaterialManagement(rawMaterialManagement);
    }

    /**
     * 修改原料管理
     *
     * @param rawMaterialManagement 原料管理
     * @return 结果
     */
    @Override
    public int updateRawMaterialManagement(RawMaterialManagement rawMaterialManagement)
    {
        return rawMaterialManagementMapper.updateRawMaterialManagement(rawMaterialManagement);
    }

    /**
     * 通过id批量删除原料管理信息
     *
     * @param ids 需要删除的原料管理主键
     * @return 结果
     */
    @Override
    public int deleteRawMaterialManagementByIds(Long[] ids)
    {
        return rawMaterialManagementMapper.deleteRawMaterialManagementByIds(ids);
    }

    /**
     * 通过id删除原料管理信息
     *
     * @param id 原料管理主键
     * @return 结果
     */
    @Override
    public int deleteRawMaterialManagementById(Long id)
    {
        return rawMaterialManagementMapper.deleteRawMaterialManagementById(id);
    }
}
